{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/var/folders/4h/kdt41ym54rg5__k93lm_0wy80000gn/T/ipykernel_14617/433317508.py:23: DeprecationWarning: Back-references to from Bit instances to their containing Registers have been deprecated. Instead, inspect Registers to find their contained Bits.\n",
      "  instruction.qubits[0].index\n",
      "/var/folders/4h/kdt41ym54rg5__k93lm_0wy80000gn/T/ipykernel_14617/433317508.py:32: DeprecationWarning: Back-references to from Bit instances to their containing Registers have been deprecated. Instead, inspect Registers to find their contained Bits.\n",
      "  instruction.qubits[0].index\n"
     ]
    }
   ],
   "source": [
    "import pickle\n",
    "from simulator import LocalSimulator, NonLocalSimulator, Simulator\n",
    "from qiskit.visualization import plot_histogram\n",
    "import os\n",
    "import matplotlib.pyplot as plt\n",
    "from collections import defaultdict\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "import numpy as np\n",
    "from matplotlib import pyplot as plt\n",
    "import seaborn as sns\n",
    "from utils import all_bitstrings\n",
    "\n",
    "n_qubits = 5\n",
    "with open('dataset/result.pkl', 'rb', ) as file:\n",
    "    protocol_results = pickle.load(file)  # # ibmq_manila\n",
    "\n",
    "M = np.zeros(shape=(2**n_qubits, 2**n_qubits))\n",
    "# M = np.zeros(shape=(2**3, 2**3))\n",
    "columns = defaultdict(list)\n",
    "for circuit, stats_count  in zip(*protocol_results):\n",
    "    measured_qubits = tuple([\n",
    "        instruction.qubits[0].index\n",
    "        for instruction in circuit\n",
    "        if instruction.operation.name == 'measure'\n",
    "    ])\n",
    "    \n",
    "    if 0 not in measured_qubits and 1 not in measured_qubits and 2 not in measured_qubits and 3 in measured_qubits and 4 in measured_qubits:\n",
    "        continue\n",
    "\n",
    "    apply_x_qubits = tuple([\n",
    "        instruction.qubits[0].index\n",
    "        for instruction in circuit\n",
    "        if instruction.operation.name == 'x'\n",
    "    ])\n",
    "\n",
    "    real_bitstring = ['0'] * n_qubits\n",
    "    for qubit in range(n_qubits):\n",
    "        if qubit not in measured_qubits:\n",
    "            real_bitstring[qubit] = '2'\n",
    "        elif qubit in apply_x_qubits:\n",
    "            real_bitstring[qubit] = '1'\n",
    "    real_bitstring = ''.join(real_bitstring)\n",
    "    \n",
    "    new_stats_count = {}\n",
    "    for bitstring, count in stats_count.items():\n",
    "        bitstring = bitstring[::-1]\n",
    "        new_bitstring = ['0'] * n_qubits\n",
    "        for qubit in range(n_qubits):\n",
    "            if qubit in measured_qubits:\n",
    "                new_bitstring[qubit] = bitstring[measured_qubits.index(qubit)]\n",
    "            else:\n",
    "                new_bitstring[qubit] = '2'\n",
    "        new_bitstring = ''.join(new_bitstring)\n",
    "        new_stats_count[new_bitstring] = count\n",
    "    stats_count = new_stats_count\n",
    "\n",
    "    # fig, ax = plt.subplots()\n",
    "    # plot_histogram(stats_count, title = real_bitstring, ax = ax)\n",
    "    # fig.savefig(os.path.join('temp/fig/ibmq_manila_protocols', real_bitstring + '.svg'))\n",
    "    # plt.close()\n",
    "    \n",
    "    for measure_bitstring, count in stats_count.items():\n",
    "        for _ in range(count):\n",
    "            for qubit in range(n_qubits):\n",
    "                columns[f'{qubit}_set'].append(real_bitstring[qubit])\n",
    "                columns[f'{qubit}_read'].append(measure_bitstring[qubit])\n",
    "                columns[f'{qubit}_measure'].append(real_bitstring[qubit] != '2')\n",
    "                columns[f'{qubit}_error'].append(real_bitstring[qubit] != measure_bitstring[qubit])\n",
    "                \n",
    "    if '2' not in real_bitstring:\n",
    "        P = [\n",
    "            stats_count[bitstring] if bitstring in stats_count else 0\n",
    "            for bitstring in all_bitstrings(n_qubits)\n",
    "            # for bitstring in all_bitstrings(3)\n",
    "        ]\n",
    "        # P = np.array(P)\n",
    "        M[:,int(real_bitstring, base=2)] = P / np.sum(P)\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAS4AAAD4CAYAAABSUAvFAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAgdUlEQVR4nO3de7gdVZ3m8e97kpCAYBBoUQmSiGQYWtOIIWLbKLcAChJspcEexxuSp7FRUAcIDaYFRwfCRXkUWtNycbAVERGCBBAV1LEFEgkJuUCMyOWACSIYh1ECIb/5o+rEfTanLntn32qf9/M89WTvWrV2rVPn7JVaa/3WKkUEZmZVMtDtApiZNcoVl5lVjisuM6scV1xmVjmuuMyscsa2+wR7nXZD5rDlkpkvycw3MHFiZtq4Gftmpj33s59lpm21//6Zac16/u5FmWl55ayKfv/5+pyaybT7GTeVDjX49f86oqlzbKm2V1xmVi2qQISUKy4zG0b0fs1VWHFJ2hOYBeyS7noMWBARq9pZMDOzLLmd85JOB64maSvfnW4CviVpTk6+2ZIWS1r89NJbW1leM2szRZTeuqXojut44K8j4vnanZIuAlYA546UKSLmA/Mhv3PezHrPQAWaikXhEJuAV42w/5Vpmpn1GTWwdUvRHdcpwI8k/Qp4NN33auC1wEllTrDinMMy0143N7sZuWLeIZlpzy+7LzMtL+ShHUP7efn6IZQg9+fL+T2Mm/b6dhTHOqCbTcCyciuuiLhF0lRgBsM75xdFxAvtLpyZdV4376TKKhxVjIhNwJ0dKIuZ9YC+CIcws9GlL+64zGx0qXwfl5mNPm4qmlnluKkIxPr1mWkr5s3KTNvz9AWZacuOfFlTZel06ELfh0rkhDxsXL06M23s1KntKI61iJuKZlY5VbjjKlxIUNKekg6WtG3d/sPbVywz65YBNpXeulfGHJI+DtwAfAxYLqm2bff5nHybJ1nPv+qq1pTUzDojGti6pKipeALwxoh4RtJk4FpJkyPiYnLuKGsnWW9at673G8xmtlk/jCoORMQzABHxkKQDSCqv3ahGU9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LfCopP+S7jqY4ctvZHkE2E/SNmmZDybpxyirdsrDB4AbymSSdDhJc/ioSBd8LBIR90XEyyNicnp9Bkk6jteWyH49SUc0kqaSDF6UWZftceBt6euDgF/VH5Dzu869Nln5iq7NSPmKrk1OGa8n57rk5Mu9LpL+amg0VNLWJGtarSKpwN6TdU1GhVb18hdtJKMmq0na6GeWzPN3JE2DZcC96faOBs97AI2NKu5NsjzHMpI/yJeVzHc2cD/JEh1XkY4wjXDct0j6wZ4n+WIcD+wI/IjkD/eHwA4l860h6TscujZfKZOvLv0hRh5VHOl8WwHfSH/Ge4CDSub7O+CXJKPJd5E8Ib3U77ro2uTky702Zf626q9Nzrlyr0tOvtzrAkwDlqT5lgNz0/2vAe5Of8bvkPG31s+bp/yYWeVUonPezKyWKy4zqxxXXGZWOa64zKxyXHGZWeW44jKzynHFZWaV8/8BsZD+8bHW3fYAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 360x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from matplotlib.colors import LinearSegmentedColormap\n",
    "\n",
    "#练习的数据：\n",
    "# data=pd.DataFrame(np.log(M*100000))\n",
    "data=pd.DataFrame(M)\n",
    "# RGB\n",
    "colors = np.array([[256, 256, 256], [236, 60, 62],  [34, 120, 181],])\n",
    "'''xia <- shang'''\n",
    "# colors.reverse()\n",
    "colors = np.array(colors) / 256\n",
    "pos = [0, 0.1, 1]  # 定义颜色的位置\n",
    "cmap = LinearSegmentedColormap.from_list('my_colormap', list(zip(pos, colors)))\n",
    "\n",
    "fig = plt.figure(figsize=(5, 4))\n",
    "#绘制热度图：\n",
    "sns.heatmap(data, cmap = cmap)\n",
    "\n",
    "fig.savefig('M_manila.svg')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "135"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.where(M > 0.01)[0].size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# O(n^3) 矩阵求逆"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "33554432"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "2**n_qubits**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAATEAAAD4CAYAAACE9dGgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAi+klEQVR4nO3deZwdVZ338c+3ExIICEmAMIHw0GGTQSNbZNEZRDbZnsAzCmR0DDBgRsZhUR/ZgiACmqigjC8ZjWEbRRQDDzuBsPo4StgjIWGXpQMhMhARI8SQ3/xR1fF22+dUdeXW7arbv/frdV+5XeeePufW7XtSVed3fiUzwznn6qpjoDvgnHNrwgcx51yt+SDmnKs1H8Scc7Xmg5hzrtaGlt3A+0+5Ljj9ef6nFay38bobB8t269g0WHbX208Hy/Zee5tgWUzHpuH2ft31YLAs1s/Y74xZ9fLLTf+dMUXfX0ysn61+f61ur5U0bFj4Cxax1ek35w5ZePbrBxdqo5lKH8Scc/WimkVd+SDmnOtB1GsUyxzEJG0HHApslm5aDNxgZovK7JhzzuURvbAv6VTgp4CA+9OHgKsknRapN1XSg5IefH3+7c3sr3OuZMJyP6og60jsWOB9Zvbnxo2SLgQeB6b3VcnMZgIzIX5h3zlXPR01W4qYFWKxCuhrimZsWuacazPqx6MKso7ETgbulPQ08FK67X8BWwP/lqeBB792QLBslzPmBMsWnDcxWBab9t93y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TMpk4IasSun/ZpcAi8zswryNmdnpZjbOzDrTtu4ys8wjIzNbArwk6b3ppn3Id7v1F4HdJY1I+7wPyXWPvG7gL0kmjwKuz1NJ0gEkp8yTLMm+m8nMHjOzMWbWme6fLpKLzktyVL+O5CI2krYlmfjIk1fuZeAj6fO9gad7vyDyWUf3Tahe1r7pq17Wvon08Toi+yVSL7pfJG3cPasqaR2SG/QsIhnMPhHaJ4NOs2YIsh4ksy9PkZzTT8tZ5+9ITh9+AzyaPg7qZ7t70b/ZyR2BB9M2rwNG5ax3DvAEsAD4EelMVR+vu4rkutmfSb4kxwIbAneS/BHfAYzOWe8ZkmuN3fvm+3nq9Sp/nr5nJ/tqbxjw4/Q9PgzsnbPe3wEPkcxKzyO5s3yuzzpr30TqRfdNnr+t3vsm0lZ0v0TqRfcL8AHgkbTeAuCsdPuWwP3pe/w5gb+1wfLwZUfOuVqrxYV955wL8UHMOVdrPog552rNBzHnXK35IOacqzUfxJxzteaDmHOu1v4HmwvNPrbIbDcAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 360x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "\n",
    "#练习的数据：\n",
    "# data=pd.DataFrame(np.log(M*100000))\n",
    "M_inv = np.linalg.inv(M) * 100\n",
    "data= pd.DataFrame(M_inv)\n",
    "# RGB\n",
    "colors = np.array([[126, 181, 126], [256, 256, 256], [236, 60, 62],  [34, 120, 181],])\n",
    "\n",
    "'''xia <- shang'''\n",
    "# colors.reverse()\n",
    "colors = np.array(colors) / 256\n",
    "pos = [0, 0.05, 0.08, 1]  # 定义颜色的位置\n",
    "cmap = LinearSegmentedColormap.from_list('my_colormap', list(zip(pos, colors)))\n",
    "\n",
    "fig = plt.figure(figsize=(5, 4))\n",
    "#绘制热度图：\n",
    "sns.heatmap(data, cmap = cmap)\n",
    "fig.savefig('M_manila_inv.svg')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(891, 1024)"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.where(np.abs(M_inv) > 1e-4)[0].size, M_inv.size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1.10221606e+00, -4.08840074e-02, -3.18681897e-02, ...,\n",
       "        -3.70053636e-07, -6.27295050e-06,  3.84437312e-06],\n",
       "       [-6.07746277e-03,  1.10588530e+00,  1.36853493e-04, ...,\n",
       "        -3.07124122e-05,  3.52264128e-06,  4.50935596e-06],\n",
       "       [-1.38859466e-02,  6.59859969e-04,  1.09029756e+00, ...,\n",
       "         1.07435379e-08,  7.02619256e-06, -3.10528811e-06],\n",
       "       ...,\n",
       "       [-5.87599623e-08,  2.55634497e-06, -9.60515445e-09, ...,\n",
       "         1.14728021e+00,  3.81772994e-04, -3.03198843e-02],\n",
       "       [ 2.22186516e-06, -8.69862873e-08,  1.85902957e-06, ...,\n",
       "         4.21485902e-04,  1.12993525e+00, -4.15883109e-02],\n",
       "       [-3.25741688e-08, -2.33152323e-07, -1.45928331e-07, ...,\n",
       "        -1.05891885e-02, -9.53324662e-03,  1.15577744e+00]])"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "M_inv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [],
   "source": [
    "from simulator import LocalSimulator, NonLocalSimulator, Simulator, MeasurementAwareNonLocalSimulator as MALSimulator\n",
    "M = NonLocalSimulator.gen_random_M(15)\n",
    "        \n",
    "from matplotlib.colors import LinearSegmentedColormap\n",
    "\n",
    "# #练习的数据：\n",
    "# # data=pd.DataFrame(np.log(M*100000))\n",
    "# data=pd.DataFrame(M)\n",
    "# # RGB\n",
    "# colors = np.array([[256, 256, 256], [236, 60, 62],  [34, 120, 181],])\n",
    "# '''xia <- shang'''\n",
    "# # colors.reverse()\n",
    "# colors = np.array(colors) / 256\n",
    "# pos = [0, 0.1, 1]  # 定义颜色的位置\n",
    "# cmap = LinearSegmentedColormap.from_list('my_colormap', list(zip(pos, colors)))\n",
    "\n",
    "# fig = plt.figure(figsize=(5, 4))\n",
    "# #绘制热度图：\n",
    "# sns.heatmap(data, cmap = cmap)\n",
    "\n",
    "# fig.savefig('M_manila.svg')\n",
    "# plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [],
   "source": [
    "M_inv = np.linalg.inv(M)  #15比特花了16分钟"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAS4AAAD4CAYAAABSUAvFAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAApKElEQVR4nO2de7wcVZXvv7+TJ4gmIteMA/JQiV5n5INOYHRGEHkoDhGcDzAGrgYQiSAgDxVBHB1mBMN7UFCIQOKgoBgVouADHyjODBBGAXlIwEdiUKIIxMvVPE7Oun9UnWN303tVdaX7nFN91vfzqQ99avWu2rW7sqlda63fkpkRBEFQJwbGugNBEASdEhNXEAS1IyauIAhqR0xcQRDUjpi4giCoHZN7fYK5J1yVdFve+P79ku02rVqZtE3afoekbWDW85O2wRUPp4+5w/ZJmz21NmnTzBlJG+vWpW0Otm59+nzTp6VtM9J9sfXpY/bi+jat+W3SNmWXV6SP6TC0Zk2ldgOzZqWPuTZ97VXZtHJV2pgYsym775ZssuG225K2ybNnJ20Ds2Yp3ZE0Lz7jptKhBj/72AGVzrG59HziCoKgXqgGEVIxcQVB0IQY/zNX4cQl6WXAQcC2+a5HgWVm9mAv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FfhuOIBsTgC+S/QN8BonfunBsUvdI0di0aVc4NolzFY5Lol2pcQHIX1l8j6xYzcz8lQR08G+pnxitiatM2P8zyP+vdRXwoJldVPZkZnaGmW1nZjvm5/qumRU+AZnZY8CvJL0037UPzfIbKVYBr5a0Zd7nfcjeY5SlMeXhCODGMo0k7U+2HD7QcsHHIszsJ2b2fDPbMR+f1WQvjh8r0fwGshfRSJpN5rwoo8v2a+B1+ee9gYdbv+D81u7YpNoVjU27dkVj4/TxBpxxcdq54yLpfw17QyVtQaZp9SDZBHZIakwmBN16y1+0kXlNVpCt0c8s2ea1ZEuDe4G78+0fOjzvXnTmVdyVTJ7jXrIb8rkl250F/JRMouMacg9Tm+9dR/YebCPZP4yjgecB3yG7cb8NbF2y3SNk7w6Hx+byMu1a7L+kvVex3fmmAp/Nr/FHwN4l270W+B8yb/IdZBXSS/3WRWPjtHPHpsy91To2zrnccXHaueMC7AL8OG93H/DhfP+LgDvza/wiiXutn7dI+QmCoHbU4uV8EARBIzFxBUFQO2LiCoKgdsTEFQRB7YiJKwiC2hETVxAEtSMmriAIasf/B4QxdnfOmHYxAAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 360x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from simulator import LocalSimulator, NonLocalSimulator, Simulator, MeasurementAwareNonLocalSimulator as MALSimulator\n",
    "M = NonLocalSimulator.gen_random_M(5)\n",
    "        \n",
    "from matplotlib.colors import LinearSegmentedColormap\n",
    "\n",
    "#练习的数据：\n",
    "# data=pd.DataFrame(np.log(M*100000))\n",
    "data=pd.DataFrame(M)\n",
    "# RGB\n",
    "colors = np.array([[256, 256, 256], [236, 60, 62],  [34, 120, 181],])\n",
    "'''xia <- shang'''\n",
    "# colors.reverse()\n",
    "colors = np.array(colors) / 256\n",
    "pos = [0, 0.1, 1]  # 定义颜色的位置\n",
    "cmap = LinearSegmentedColormap.from_list('my_colormap', list(zip(pos, colors)))\n",
    "\n",
    "fig = plt.figure(figsize=(5, 4))\n",
    "#绘制热度图：\n",
    "sns.heatmap(data, cmap = cmap)\n",
    "\n",
    "fig.savefig('M_manila.svg')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "tf2",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.13"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
